﻿<UserControl x:Class="EyeOpen.Market.UI.Silverlight.BusyIndicator"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d"
    xmlns:Customers="clr-namespace:EyeOpen.Market.UI.Silverlight"
    xmlns:ControlsToolkit="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Toolkit">
    <UserControl.Resources>
        <Style
            x:Key="Container"
            TargetType="ControlsToolkit:HeaderedContentControl">
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate
                        TargetType="ControlsToolkit:HeaderedContentControl">
                        <Grid>
                            <ContentControl
                                Content="{TemplateBinding Header}"
                                FontWeight="Bold"
                                HorizontalAlignment="Center"
                                Margin="4"/>
                            <Border
                                BorderBrush="Gray"
                                BorderThickness="1">
                                <ContentPresenter
                                    Content="{TemplateBinding Content}"/>
                            </Border>
                        </Grid>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
        <Style
            x:Key="Content" 
            TargetType="ContentControl">
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate
                        TargetType="ContentControl">
                        <Customers:Customers/>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
    </UserControl.Resources>
    <StackPanel
        DataContext="{Binding Path=CustomerViewModel, Source={StaticResource viewModelLocator}}">
        <ControlsToolkit:HeaderedContentControl
            Style="{StaticResource Container}">
            <ControlsToolkit:BusyIndicator
                IsBusy="{Binding IsBusy}"
                BusyContent="Loading customer list"
                DisplayAfter="0">
                <ContentControl
                    Style="{StaticResource Content}"/>
            </ControlsToolkit:BusyIndicator>
        </ControlsToolkit:HeaderedContentControl>
    </StackPanel>
</UserControl>
